<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .active{
            color: red;
        }
    </style>
</head>
<body>
<!-- 点击哪一项，该项的文字变成红色 -->
    <div id="app">
       <ul>
           <li @click="changecolor(index)" 
           :class="{'active': count ==  index}"
            v-for='(item,index) in movies'>{{index}}--{{item}}</li>
       </ul>
    </div>
    <script src="../js/vue.js"></script>
    <script>
        const app = new Vue({
            el:'#app',
            data:{
                count: '0',
                message:'你好呀！',
                movies:['红枣','香梨','葡萄','香蕉']
            },
            methods:{
                changecolor(index){
                    console.log(index);
                   this.count = index
                }
            }
        })
    </script>
</body>
</html>